﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.Xpo;

namespace ChuanPlus
{
    public class Product : XPLiteObject
    {
        int fID;
        [Key(true)]
        public int ID
        {
            get { return fID; }
            set { SetPropertyValue<int>("ID", ref fID, value); }
        }
        string fItemCode;
        [Size(20)]
        public string ItemCode
        {
            get { return fItemCode; }
            set { SetPropertyValue<string>("ItemCode", ref fItemCode, value); }
        }
        Distributor fDistributorID;
        public Distributor DistributorID
        {
            get { return fDistributorID; }
            set { SetPropertyValue<Distributor>("DistributorID", ref fDistributorID, value); }
        }
        string fDescription;
        [Size(200)]
        public string Description
        {
            get { return fDescription; }
            set { SetPropertyValue<string>("Description", ref fDescription, value); }
        }
        string fUnit;
        [Size(20)]
        public string Unit
        {
            get { return fUnit; }
            set { SetPropertyValue<string>("Unit", ref fUnit, value); }
        }
        
        double fRedInvQty;
        public double RedInvQty
        {
            get { return fRedInvQty; }
            set { SetPropertyValue<double>("RedInvQty", ref fRedInvQty, value); }
        }
        double fUnitPrice;
        public double UnitPrice
        {
            get { return fUnitPrice; }
            set { SetPropertyValue<double>("UnitPrice", ref fUnitPrice, value); }
        }
        double fTax;
        public double Tax
        {
            get
            {
                return fTax;
            }
            set
            {
                SetPropertyValue<double>("Tax", ref fTax, value);
            }
        }
        bool fIsRawMaterial;
        public bool IsRawMaterial
        {
            get { return fIsRawMaterial; }
            set { SetPropertyValue<bool>("IsRawMaterial", ref fIsRawMaterial, value); }
        }
        public Product(Session session) : base(session) { }
        public Product() : base(Session.DefaultSession) { }
        /// <summary>
        /// Initializes a new instance of the Product class.
        /// </summary>
        /// <param name="fItemCode"></param>
        /// <param name="fDistributorID"></param>
        /// <param name="fDescription"></param>
        /// <param name="fUnit"></param>
        /// <param name="fRebInvQty"></param>
        /// <param name="fUnitPrice"></param>
        /// <param name="fTax"></param>
        /// <param name="fIsRawMaterial"></param>
        public Product(string fItemCode, Distributor fDistributorID, string fDescription, string fUnit, double fRedInvQty, double fUnitPrice, double fTax, bool fIsRawMaterial)
        {
            this.fItemCode = fItemCode;
            this.fDistributorID = fDistributorID;
            this.fDescription = fDescription;
            this.fUnit = fUnit;
            this.fRedInvQty = fRedInvQty;
            this.fUnitPrice = fUnitPrice;
            this.fTax = fTax;
            this.fIsRawMaterial = fIsRawMaterial;
        }
        public override void AfterConstruction() { base.AfterConstruction(); }
        
    }
}
